<template>
  <div class="Mygoodlist">
    <ul>
      <li v-for="(v, index) in goodArr" :key="index" @click="fun">
        <img :src="v.img" />
        <div class="Mygoodlistone">
          <p>
            <span>{{ v.msg }}</span>
          </p>
          <p>
            <span>￥{{ v.price }}</span>
          </p>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
import service from "../../../utils/service";
export default {
  methods: {
    fun() {
      //方法1:
      this.$router.push("/Purchase");
    },
  },
  data() {
    return {
      goodArr: [
        //     {
        //       img: "https://img12.360buyimg.com/n1/s450x450_jfs/t1/59022/28/10293/141808/5d78088fEf6e7862d/68836f52ffaaad96.jpg",
        //       msg: "Apple iPhone 11 (A2223) 128GB 黑色 移动联通电信4G手机 双卡双待",
        //       price: 4999,
        //     },
        //     {
        //       img: "https://img.alicdn.com/imgextra/i1/1714128138/O1CN01VUJK3f29zForLahYc_!!0-item_pic.jpg_430x430q90.jpg",
        //       msg: "小米全面屏65英寸E65X 4K超高清 HDR 2GB+8GB 智能网络电视",
        //       price: 3999,
        //     },
        //     {
        //       img: "http://img12.360buyimg.com/n1/jfs/t1/125178/7/16502/43895/5f9a653cEb261b37f/feebe84826ae1cfc.jpg",
        //       msg: "米家直驱洗烘一体机",
        //       price: 2999,
        //     },
        //     {
        //       img: "https://img.alicdn.com/imgextra/https://img.alicdn.com/imgextra/i4/1714128138/O1CN014gUF0929zFosv89eg_!!1714128138.jpg_430x430q90.jpg",
        //       msg: "【小米智能生活】米家扫地机器人家用全自动扫拖一体机拖地吸尘器",
        //       price: 1999,
        //     },
        //     {
        //       img: "https://img.alicdn.com/imgextra/https://img.alicdn.com/imgextra/i4/2207959261164/O1CN017HZL7g1KT9ePJtXHi_!!2207959261164.jpg_430x430q90.jpg",
        //       msg: "【官方正品】全新Dior迪奥烈艳蓝金唇膏传奇新色丝绒999 720",
        //       price: 356,
        //     },
        //     {
        //       img: "https://img.alicdn.com/imgextra/https://img.alicdn.com/imgextra/i1/755579902/O1CN01OtNTQk2N1ATlHy6xO_!!755579902.jpg_430x430q90.jpg",
        //       msg: "卡姿兰口红雾吻水吻唇膏哑光大牌秋冬奶茶色女小众学生款官方旗舰",
        //       price: 119,
        //     },
        //     {
        //       img: "https://img.alicdn.com/imgextra/i4/3170729146/O1CN016g20382HQv3RkB4Ph_!!0-item_pic.jpg_430x430q90.jpg",
        //       msg: "【官方正品】MAC/魅可尤雾弹唇膏口红大牌正品316/923奶茶色",
        //       price: 180,
        //     },
        //     {
        //       img: "https://img.alicdn.com/imgextra/i4/3170729146/O1CN016g20382HQv3RkB4Ph_!!0-item_pic.jpg_430x430q90.jpg",
        //       msg: "【官方正品】MAC/魅可尤雾弹唇膏口红大牌正品316/923奶茶色",
        //       price: 180,
        //     },
        //     {
        //       img: "https://img.alicdn.com/imgextra/i4/3170729146/O1CN016g20382HQv3RkB4Ph_!!0-item_pic.jpg_430x430q90.jpg",
        //       msg: "【官方正品】MAC/魅可尤雾弹唇膏口红大牌正品316/923奶茶色",
        //       price: 180,
        //     },
        //     {
        //       img: "https://img.alicdn.com/imgextra/i4/3170729146/O1CN016g20382HQv3RkB4Ph_!!0-item_pic.jpg_430x430q90.jpg",
        //       msg: "【官方正品】MAC/魅可尤雾弹唇膏口红大牌正品316/923奶茶色",
        //       price: 180,
        //     },
      ],
    };
  },
  data() {
    return {
      goodArr: [],
    };
  },
  mounted() {
    service({
      url: "goodStore",
      method: "get",
      //   data: {count:1,limitNum:10}
    }).then((res) => {
      // console.log(res.data);
      // res.data.navlist.forEach(element => {
      //     this.Arr.push(element);
      // });
      this.goodArr = res.data;
    });
  },
};
</script>

<style scoped>
.Mygoodlist {
  column-count: 2;
  margin: 10px;
}

.Mygoodlist > ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-evenly;
  /* margin-top: 20px; */
}
li {
  list-style: none;
}
.Mygoodlist > ul > li {
  /* width: 47%;
  height: 100%;
  background-color: white;
  font-size: 14px;
  margin-bottom: 10px;
  border-radius: 10px;
  break-inside: avoid; */
  background-color: white;
  margin-bottom: 10px;
  border-radius: 10px;
  break-inside: avoid;
}
.Mygoodlist > ul > li > .Mygoodlistone > p:nth-child(1) > span {
  height: 26px;
  font-size: 12px;
  padding: 5px;
  /* text-overflow: -o-ellipsis-lastline; */
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  /* line-clamp: 2; */
  -webkit-box-orient: vertical;
}
.Mygoodlist > ul > li > .Mygoodlistone > p:nth-child(2) > span {
  color: red;
  font-size: 20px;
}
.Mygoodlist > ul > li > img {
  width: 100%;
  border-radius: 10px;
}
</style>